<?php

include_once($_SERVER['DOCUMENT_ROOT'] . '/htqlmba/configs/database.php');

class LoaiDienAp extends Database {

    private $MA_DIEN_AP;
    private $CAP_DIEN_AP;

    public function setMA_DIEN_AP($MA_DIEN_AP) {
        $this->MA_DIEN_AP = $MA_DIEN_AP;
    }

    public function getMA_DIEN_AP() {
        return $this->MA_DIEN_AP;
    }

    public function setCAP_DIEN_AP($CAP_DIEN_AP) {
        $this->CAP_DIEN_AP = $CAP_DIEN_AP;
    }

    public function getCAP_DIEN_AP() {
        return $this->CAP_DIEN_AP;
    }

    // function them tram
    public function themCDA() {
        $query = "insert into loai_dien_ap(MA_DIEN_AP,CAP_DIEN_AP) 
            values ('" . $this->getMA_DIEN_AP() . "','" . $this->getCAP_DIEN_AP() . "')";
        $this->setQuery($query);
        return $this->executeQuery();
    }

    public function suaCDA() {
        $query = "	UPDATE loai_dien_ap
						SET CAP_DIEN_AP = '" . $this->getCAP_DIEN_AP() . "' 
						WHERE MA_DIEN_AP = '" . $this->getMA_DIEN_AP() . "';";
        $this->setQuery($query);
        return $this->executeQuery();
    }

    public function xoaCDA() {
        $this->setQuery("delete from loai_dien_ap where  MA_DIEN_AP='" . $this->getMA_DIEN_AP() . "'");
        return $this->executeQuery();
    }

    public function dsLDA() {
        $this->setQuery("select MA_DIEN_AP,CAP_DIEN_AP
							 from loai_dien_ap
ORDER BY MA_DIEN_AP  DESC
							 ");
        return $this->fetchAll();
    }

}

?>